


import plotting.*;

Figure fig;

double[] y;
int start=0;
int cur=39;
int n=39;

void setup()  {  
  size(520, 320);
  y=new double[40];
  for (int j=0;j<40;j++) y[j]=random(0.0,1.0)*10+40;
  
  fig=new Figure(this,new Rectangle(60,60,400,200));
  fig.autoScaleX=true;
  fig.autoScaleY=true;
  fig.update();
}

void draw() {

  y[cur]=random(0.0,1.0)*10+40;
  // clear the screen:
  noFill();
  background(0);
  fig.draw();
  fig.plot(y,Figure.Approx.linear,start,n);
  
  start+=1; if (start==40) start=0;
  cur+=1; if (cur==40) cur=0;
  
  delay(50);
}


